using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DevExpress.ExpressApp.DC;
using DevExpress.Persistent.Base;
using DevExpress.Persistent.BaseImpl;
using DevExpress.Xpo;
namespace Ascent.Module.BusinessObjects.Sales
{
  [DefaultClassOptions]
  [DevExpress.Persistent.Base.NavigationItemAttribute("销售管理")]
  [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("销售订单")]
  public partial class SaleOrder : DevExpress.Persistent.BaseImpl.BaseObject
  {
    private System.Single _taxRate;
    private System.Boolean _taxIncluded;
    private System.Single _discount;
    private Ascent.Module.BusinessObjects.Sales.Customer _customer;
    private System.Single _totalAmount;
    private System.Single _amount;
    private System.Single _taxAmount;
    private System.Single _discountAmount;
    private System.String _remarks;
    private System.String _invoiceNumber;
    private System.DateTime _timeOfPayment;
    private Ascent.Module.BusinessObjects.Base.Employee _employee;
    private System.DateTime _deliveryDate;
    private System.String _sOCode;
    public SaleOrder(DevExpress.Xpo.Session session)
      : base(session)
    {
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("销售单号")]
    public System.String SOCode
    {
      get
      {
        return _sOCode;
      }
      set
      {
        SetPropertyValue("SOCode", ref _sOCode, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("客户")]
    public Ascent.Module.BusinessObjects.Sales.Customer Customer
    {
      get
      {
        return _customer;
      }
      set
      {
        if (_customer == value)
          return;
        Ascent.Module.BusinessObjects.Sales.Customer prevCustomer = _customer;
        _customer = value;
        if (IsLoading)
          return;
        if (prevCustomer != null && prevCustomer.SaleOrder == this)
          prevCustomer.SaleOrder = null;
        if (_customer != null)
          _customer.SaleOrder = this;
        OnChanged("Customer");
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("交货日期")]
    public System.DateTime DeliveryDate
    {
      get
      {
        return _deliveryDate;
      }
      set
      {
        SetPropertyValue("DeliveryDate", ref _deliveryDate, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("销售代表")]
    public Ascent.Module.BusinessObjects.Base.Employee Employee
    {
      get
      {
        return _employee;
      }
      set
      {
        if (_employee == value)
          return;
        Ascent.Module.BusinessObjects.Base.Employee prevEmployee = _employee;
        _employee = value;
        if (IsLoading)
          return;
        if (prevEmployee != null && prevEmployee.SaleOrder == this)
          prevEmployee.SaleOrder = null;
        if (_employee != null)
          _employee.SaleOrder = this;
        OnChanged("Employee");
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("付款期限")]
    public System.DateTime TimeOfPayment
    {
      get
      {
        return _timeOfPayment;
      }
      set
      {
        SetPropertyValue("TimeOfPayment", ref _timeOfPayment, value);
      }
    }
    [DevExpress.Persistent.Base.ImmediatePostDataAttribute]
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("折扣%")]
    public System.Single Discount
    {
      get
      {
        return _discount;
      }
      set
      {
        SetPropertyValue("Discount", ref _discount, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("是否含税")]
    [DevExpress.Persistent.Base.ImmediatePostDataAttribute]
    public System.Boolean TaxIncluded
    {
      get
      {
        return _taxIncluded;
      }
      set
      {
        SetPropertyValue("TaxIncluded", ref _taxIncluded, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("发票号码")]
    public System.String InvoiceNumber
    {
      get
      {
        return _invoiceNumber;
      }
      set
      {
        SetPropertyValue("InvoiceNumber", ref _invoiceNumber, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("税率%")]
    public System.Single TaxRate
    {
      get
      {
        return _taxRate;
      }
      set
      {
        SetPropertyValue("TaxRate", ref _taxRate, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("备注")]
    public System.String Remarks
    {
      get
      {
        return _remarks;
      }
      set
      {
        SetPropertyValue("Remarks", ref _remarks, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("合计金额")]
    [DevExpress.Persistent.Base.ImmediatePostDataAttribute]
    public System.Single TotalAmount
    {
      get
      {
        return _totalAmount;
      }
      set
      {
        SetPropertyValue("TotalAmount", ref _totalAmount, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("折扣金额")]
    [DevExpress.Persistent.Base.ImmediatePostDataAttribute]
    public System.Single DiscountAmount
    {
      get
      {
        return _discountAmount;
      }
      set
      {
        SetPropertyValue("DiscountAmount", ref _discountAmount, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("税金金额")]
    [DevExpress.Persistent.Base.ImmediatePostDataAttribute]
    public System.Single TaxAmount
    {
      get
      {
        return _taxAmount;
      }
      set
      {
        SetPropertyValue("TaxAmount", ref _taxAmount, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("实际金额")]
    [DevExpress.Persistent.Base.ImmediatePostDataAttribute]
    public System.Single Amount
    {
      get
      {
        return _amount;
      }
      set
      {
        SetPropertyValue("Amount", ref _amount, value);
      }
    }
    [DevExpress.Xpo.AssociationAttribute("SaleOrderDetails-SaleOrder")]
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("销售明细")]
    public XPCollection<Ascent.Module.BusinessObjects.Sales.SaleOrderDetail> SaleOrderDetails
    {
      get
      {
        return GetCollection<Ascent.Module.BusinessObjects.Sales.SaleOrderDetail>("SaleOrderDetails");
      }
    }
  }
}
